#include "testmainwidget.h"
#include "qimpenwidget.h"

TestMainWidget::TestMainWidget( QWidget *parent, const char *name, WFlags f )
	: QWidget(parent, name, f)
{
	
	matcher = new QIMPenMatch( this );
	connect( matcher, SIGNAL(keypress(uint)), this, SLOT(keypress(uint)) );
    connect( matcher, SIGNAL(erase()), this, SLOT(erase()) );

	//QGridLayout *gl = new QGridLayout( this, 5, 2, 1, 0 );
    //gl->setColStretch( 0, 1 );
	connect( matcher, SIGNAL(matchedCharacters(const QIMPenCharMatchList &)),
	     this, SLOT(matchedCharacters(const QIMPenCharMatchList &)) );
    //connect( matcher, SIGNAL(matchedWords(const QIMPenMatch::MatchWordList&)),
	//     wordPicker, SLOT(setWords(const QIMPenMatch::MatchWordList&)) );
	
	
	pw = new QIMPenWidget( this );
    //gl->addMultiCellWidget( pw, 1, 4, 0, 0 );
	
	int bh = pw->sizeHint().height()/4;
	
	connect( matcher, SIGNAL(removeStroke()), pw, SLOT(removeStroke()) );
    connect( pw, SIGNAL(changeCharSet( QIMPenCharSet * )),
             matcher, SLOT(setCharSet( QIMPenCharSet * )) );
    connect( pw, SIGNAL(changeCharSet( int )),
             this, SLOT(selectCharSet( int )) );
    connect( pw, SIGNAL(beginStroke()),
	     matcher, SLOT(beginStroke()) );
    connect( pw, SIGNAL(stroke( QIMPenStroke * )),
             this, SLOT(strokeEntered( QIMPenStroke * )) );
    connect( pw, SIGNAL(stroke( QIMPenStroke * )),
             matcher, SLOT(strokeEntered( QIMPenStroke * )) );
	
}